﻿@*@model EasyLift.TMS.Web.Helpers.PaginatedList<EasyLift.TMS.Web.Models.Vehicle>*@

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


    <div id="ActionLinkButtons">
        @Html.ActionLink("Create New " , "Create") 
    </div>

    <script type="text/javascript">
        jQuery(document).ready(function () {
            $("#list").jqGrid({                
                url: '/Vehicle/GridData',
                width: 720,
                height: 250,
                datatype: 'json',
                mtype: 'GET',
                colNames: ['Vehicle Number', 'Door No', 'License Plate Number', 'CompanyCode', 'VIN', 'Trailor No', 'Vehicle Mission Status'],
                colModel: [
                        { name: 'VehicleNumber', index: 'VehicleNumber', width: 140, align: 'left', hidden: false, search: true, searchoptions: { sopt: ['cn'] }, formatter: EditLinkFormatter },
                        { name: 'DoorNo', index: 'DoorNo', width: 140, align: 'left', hidden: false, search: true, searchoptions: { sopt: ['cn'] }, formatter: EditLinkFormatter },
                        { name: 'LicensePlateNumber', index: 'LicensePlateNumber', width: 240, align: 'left', search: true, searchoptions: { sopt: ['cn']} },
                        { name: 'CompanyCode', index: 'CompanyCode', width: 240, align: 'left', search: true, searchoptions: { sopt: ['cn']} },
                        { name: 'VIN', index: 'VIN', width: 240, align: 'left', search: true, searchoptions: { sopt: ['cn']} },
                        { name: 'TrailorNo', index: 'TrailorNo', width: 240, align: 'left', search: true, searchoptions: { sopt: ['cn']} },
                        { name: 'VehicleMissionStatus', index: 'VehicleMissionStatus', width: 140, align: 'left', search: false}],
                pager: '#pager',
                rowNum: 10,
                rowList: [10, 20, 50],
                shrinkToFit: false,
                sortname: 'VehicleNumber',
                sortorder: "DESC",
                viewrecoreds: false,
                rownumbers: true,
                hidegrid: false,
                imgpath: ''
            }).jqGrid('navGrid', '#pager', { edit: false, add: false, del: true, refresh: true, search: true }, {}, {}, { url: "Delete" });
        });

        function EditLinkFormatter(cellvalue, options, rowObject) {
            return '<a href=Edit/' + rowObject[0] + ' >' + cellvalue + '</a>'
        }

    </script>

    <table id="list"><tr><td/></tr></table>
    <div id="pager"></div>